﻿package com.x.xdweb.util;



import java.text.DecimalFormat;

public class FormatUtil {

	public static String DECIMAL_STYLE1 = "#,###,###,###,##0.0000";

	public static String DECIMAL_STYLE2 = "#,###,###,###,##0.00";

	public static String DECIMAL_STYLE3 = "####0.00";

	public static String decimalFormat(double d, String style) {
		String vlaue = "0.00";
		try {
			DecimalFormat format = new DecimalFormat(style);
			vlaue = format.format(d);
		} catch (Exception e) {
			// TODO: handle exception
		}
		return vlaue;
	}
	
	
	public static String decimalFormat(String data,String style){
		String vlaue = "0.00";
		try {
			double d = Double.parseDouble(data);
			DecimalFormat format = new DecimalFormat(style);
			vlaue = format.format(d);
			
		} catch (Exception e) {
			// TODO: handle exception
		}
		return vlaue;
	}
	
	
	   
	
}
